package com.xxdd.plugina

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
import com.xxdd.lifecyclelib.LifecycleInterface

open class ShadowActivity : LifecycleInterface{

    lateinit var that : Activity


    override fun attach(context : Activity){
        that = context;
    }



    fun setContentView(layoutId : Int){
        that.setContentView(layoutId)
    }

    fun findViewById(id : Int): View {
        return that.findViewById(id);
    }

    fun startActivity(intent: Intent ){
//        val Intent = Intent()
        intent.putExtra("className", intent.component?.className)
        that.startActivity(intent)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        Log.e("xxdd", "onCreate")
    }

    override fun onStart() {
        Log.e("xxdd", "onStart")
    }

    override fun onResume() {
        Log.e("xxdd", "onResume")
    }

    override fun onStop() {
        Log.e("xxdd", "onStop")
    }

    override fun onDestroy() {
        Log.e("xxdd", "onDestroy")
    }

    override fun onSaveInstanceState(outState: Bundle) {
        Log.e("xxdd", "onSaveInstanceState")
    }

    override fun onTouchEvent(event: MotionEvent): Boolean {
        Log.e("xxdd", "onTouchEvent")
        return false
    }

    override fun onBackPressed() {
        Log.e("xxdd", "onBackPressed")
    }


}